﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

namespace ExFlash.Filters
{
    public class FilterList : ISwfSerializable, IList<Filter>
    {
        public Byte NumberOfFilters
        {
            get;
            private set;
        }

        public Filter[] Filter
        {
            get;
            private set;
        }

        #region ISwfSerializable Members

        public void SwfDeserialize(BinaryBitReader reader)
        {
            NumberOfFilters = reader.ReadByte();

            Filter = new Filter[NumberOfFilters];

            for (int i = 0; i < NumberOfFilters; i++)
            {
                Filter[i] = new Filter();
                Filter[i].SwfDeserialize(reader);
            }
        }

        public void SwfSerialize(byte[] arr, ref int offset)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region IList<Filter> Members

        public int IndexOf(Filter item)
        {
            return Array.IndexOf(Filter, item);
        }

        public void Insert(int index, Filter item)
        {
            throw new NotImplementedException();
        }

        public void RemoveAt(int index)
        {
            throw new NotImplementedException();
        }

        public Filter this[int index]
        {
            get
            {
                return Filter[index];
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        #endregion

        #region ICollection<Filter> Members

        public void Add(Filter item)
        {
            throw new NotImplementedException();
        }

        public void Clear()
        {
            throw new NotImplementedException();
        }

        public bool Contains(Filter item)
        {
            return Filter.Contains(item);
        }

        public void CopyTo(Filter[] array, int arrayIndex)
        {
            Filter.CopyTo(array, arrayIndex);
        }

        public int Count
        {
            get { return NumberOfFilters; }
        }

        public bool IsReadOnly
        {
            get { return true; }
        }

        public bool Remove(Filter item)
        {
            throw new NotImplementedException();
        }

        #endregion

        #region IEnumerable<Filter> Members

        public IEnumerator<Filter> GetEnumerator()
        {
            return (IEnumerator<Filter>)Filter.GetEnumerator();
        }

        #endregion

        #region IEnumerable Members

        IEnumerator IEnumerable.GetEnumerator()
        {
            return Filter.GetEnumerator();
        }

        #endregion
    }
}
